package com.logos.musicframe.resp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.ai.chat.messages.Message;

/**
 * @author logos
 * date 2025/6/17 15:25
 * @version v1.0
 * @Package com.logos.musicframe.resp
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class MsgResp {

    private String role;

    private String content;

    public MsgResp(Message message) {
        switch (message.getMessageType()){
            case USER:
                this.role = "user";
                break;
            case ASSISTANT:
                this.role = "assistant";
                break;
            case SYSTEM:
                this.role = "system";
                break;
            case TOOL:
                this.role = "tool";
                break;
            default:
                this.role = "unknown";
        }
        this.content = message.getText();
    }
}
